-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional tweaking of the .gv output #215
Conversation
Will check it this weekend |
Man that was a long "this weekend" finally getting to it this afternoon... :-| |
Solves wireviz#174 intermediately by allowing low level .gv tweaking.
Could you please provide a sample file where you |
src/wireviz/Harness.py
Outdated
if len(value) == 0 or ' ' in value: | ||
value = value.replace('"', r'\"') | ||
value = f'"{value}"' | ||
# TODO?: If value is None: delete attr, and if attr not found: append it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both ideas make sense. I guess this would be a separate PR in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that was the plan. The current implementation should be enough to solve the original issue and a lot of similar experimental tweaking, but I don't expect a huge number of users will need such tweaking in their harnesses. Maybe it'll mainly be a tool for developers to test variations of .gv
output before suggesting a proper implementation of a new feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just implemented these features and committed them to this PR as well.
See the already provided link to such an example in the second bullet of this PR description. |
dot.body[i] = entry | ||
|
||
if self.tweak.append is not None: | ||
if isinstance(self.tweak.append, list): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason that the append
section should be a list, and not a string?
Is there a benefit to having multiple list entries for different tweaks, as opposed to all of them concatenated into one string? I am not opposed to it, just genuinely curious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially, I used a list of quoted strings to easily specify leading spaces where I wanted them. Leading spaces in multiline strings seems to be stripped by the YAML parser, but maybe you know a way to avoid that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you include the indentation indicator (source), any additional leading spaces are preserved. I quickly tested this and it works. Example:
tweak:
append: |2 # two leading spaces will be interpreted as indentation; any more will be preserved
// Tweaking two cable nodes to keep close to each other
subgraph cluster1 {
color=yellow // Same as background to hide the surrounding frame
TPPinkSilver
TPBlueSilver
}
- Improve syntax description - Improve typecheck() function parameter names and type hints Co-authored-by: Daniel Rojas <[email protected]>
c73213b
to
4945d26
Compare
syntax.md
for accepted input value types..gv
file, and appending any number of custom entries, e.g. nodes, edges, and subgraphs. Overriding entries with attributes containing HTML is not tested, and will probably need more advanced functionality, but no such plans without any requests.This PR also contains the commits from Add basic options and metadata #214 and will probably need a rebase after Add basic options and metadata #214 gets merged in.(rebase done)dev
, I might change the contents of my branch at any time, including force-push that breaks old commit history.